package com.javaeedev.junit;

import java.rmi.RemoteException;

public class Monitor {

    private AuthService service;

    public Monitor(AuthService service) {
        this.service = service;
    }

    public String getSystemInfo(String username, String password) throws AuthenticateException {
        if(username==null || password==null)
            throw new NullPointerException();
        username = username.trim();
        if(username.equals(""))
            throw new IllegalArgumentException();
        try {
            service.authenticate(username, password);
        }
        catch(RemoteException e) {
            throw new RuntimeException(e);
        }
        return "OK";
    }
}
